<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
	</head>
	<body>
		<div id="app">
			<h1>使用v-model绑定子组件属性</h1>
			
			{{title}}
			<title-component v-model:currtitle="title"></title-component>
		</div>
		
		<script>
			var app = Vue.createApp({
				data(){
					return {
						title:"111",
					}
				}
			})
			
			app.component('title-component',{
				props: ['currtitle'],
				emits: ['update:currtitle'],
				template: `
				<p>标题是:
					<input type='text' :value='currtitle' 
					@input='$emit("update:currtitle", $event.target.value)'/>
				</p>`
				
			})
			
			var vm = app.mount("#app")
		</script>
	</body>
</html>
